<?php

namespace App\Http\Controllers\Admin\Construction;

use Illuminate\Http\Request;
use App\Http\Controllers\Admin\BaseController;
use App\Services\Admin\ConstructionService;
use DB;


/**
 * 荣誉成果（教学建设管理）
 * Class Award
 * @package App\Http\Controllers\Admin\Construction
 */
class ConstructionController extends BaseController
{
    protected $service;

    public function __construct(ConstructionService $service)
    {
    	parent::__construct();
        $this->service = $service;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('themes.admin.construction.index');
    }

    public function awardData() {
        $awardsdata = $this->service->ajaxData();
        return $awardsdata;
    }

    // 教学建设成果类别界面渲染
    public function ConstructionCategoryIndex() {
        return view('themes.admin.construction.category');
    }

    // 教学建设成果类别数据接口
    public function categoryData() {
        $categoryData = $this->service->categoryData();
        return $categoryData;
    }

     /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $result = $this->service->show($id);
        return view(getThemeView('construction.show'))->with($result);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $result = $this->service->edit($id);
        return view('themes.admin.construction.edit')->with($result);
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $this->service->destroy($id);
        return redirect()->route('construction.index');
    }
}